﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DFGK_WMS.Context.Migrations
{
    public partial class 横向采购分析 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "T_ProcurementCostAnalysis",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    SupplierID = table.Column<int>(type: "int", nullable: false),
                    ProductID = table.Column<int>(type: "int", nullable: false),
                    PurchaseOrderID = table.Column<int>(type: "int", nullable: false),
                    QuotationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    QuotedTotal = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    DiscountRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    EffectivePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    TransportCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    LogisticsCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    DeliveryDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ShippingMethod = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShippingDistance = table.Column<int>(type: "int", nullable: false),
                    QualityRating = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Cost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    WarrantyCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ReturnRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    StrategyID = table.Column<int>(type: "int", nullable: false),
                    EvaluationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CostSavings = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    EfficiencyImprovement = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    SupplierPerformance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    HistoricalCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CurrentCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CostChangePercentage = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    MarketTrendID = table.Column<int>(type: "int", nullable: false),
                    MarketTrendDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    RawMaterialPriceChange = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    MarketDemand = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    MarketPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    PartnershipDuration = table.Column<int>(type: "int", nullable: false),
                    DiscountsFromPartnership = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CostSavingsDueToPartnership = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    StrategicBenefits = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AnalysisDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CostCategory = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateUserId = table.Column<long>(type: "bigint", nullable: false),
                    CreateUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ModifyUserId = table.Column<long>(type: "bigint", nullable: false),
                    ModifyUserName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDel = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_ProcurementCostAnalysis", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_ProcurementCostAnalysis");
        }
    }
}
